package com.xbh.management.config;

import io.minio.MinioClient;
import io.minio.errors.InvalidEndpointException;
import io.minio.errors.InvalidPortException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @program: management-center
 * @description:
 * @author: 许宝华
 * @create: 2021-09-06 08:37
 */

@Configuration
public class MinioConfig {


    @Value("${minio.host}")
    private String host;
    @Value("${minio.secretKey}")
    private String secretKey;
    @Value("${minio.accessKey}")
    private String accessKey;

    @Bean
    public MinioClient minioClient() {
        MinioClient minioClient = null;
        try {
            minioClient = new MinioClient(host, accessKey, secretKey);
        } catch (InvalidEndpointException e) {
            e.printStackTrace();
        } catch (InvalidPortException e) {
            e.printStackTrace();
        }
        return minioClient;
    }
}

